/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.swirrel.listener;

import java.awt.Component;
import java.lang.reflect.Method;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import org.swirrel.util.SwirrelException;
import org.swirrel.util.MethodCall;

/**
 *
 * @author Gronau
 */
public class SwirrelUndoableEditListener extends AbstractSwirrelListener implements UndoableEditListener {

    private final MethodCall undoableEditHappenedCall;

       public SwirrelUndoableEditListener(MethodCall undoableEditHappenedCall) {
        this.undoableEditHappenedCall = undoableEditHappenedCall;
        if(! checkSignature(undoableEditHappenedCall, UndoableEditEvent.class)) {
            throw new SwirrelException("Method must have none or one UndoableEditEvent argument");
        }
    }

    public void undoableEditHappened(UndoableEditEvent e) {
         call(undoableEditHappenedCall, e);
    }

}
